//
//  MineAboutVC.m
//  XJMCustomer
//
//  Created by Mr.hu on 2017/10/25.
//  Copyright © 2017年 Mr.hu. All rights reserved.
//

#import "MineAboutVC.h"

@interface MineAboutVC ()
@property (weak, nonatomic) IBOutlet UIView *BackLayerBorder;
@property (weak, nonatomic) IBOutlet UILabel *Current_Version;
@property (weak, nonatomic) IBOutlet UILabel *Current_companyUrl; //公司网址
@property (weak, nonatomic) IBOutlet UILabel *Current_Mailbox;    //邮箱
@property (weak, nonatomic) IBOutlet UILabel *Current_WechatNumber;
@property (weak, nonatomic) IBOutlet UILabel *Current_qqService;
@property (weak, nonatomic) IBOutlet UILabel *Current_companyphone;
@property (weak, nonatomic) IBOutlet UILabel *Current_message;


@end

@implementation MineAboutVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addLeftBtn:[UIImage imageNamed:@"fanhui"] Action:@selector(backToPrevious)];
    self.title = @"关于我们";
    
    self.BackLayerBorder.layer.borderColor = [UIColor grayColor].CGColor;
    self.BackLayerBorder.layer.borderWidth = 0.6;
    self.BackLayerBorder.layer.cornerRadius = 10;
    
    AFHTTPSessionManager * sessionmanager = [[AFHTTPSessionManager alloc]init];
    //申明返回来的结果是二进制类型
    sessionmanager.responseSerializer = [AFHTTPResponseSerializer serializer];
    //如果报接受类型不一致，请替换一致text/html  或者 text/plain
    sessionmanager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];
    //设置请求超时时间
    [sessionmanager.requestSerializer setTimeoutInterval:30.0];
    
    [sessionmanager GET:@"http://api.xijiaomo.com/tech.php/v2/Notice/techer_about" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        NSString * friendstg =[[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSData * frienddata =[friendstg dataUsingEncoding:NSUTF8StringEncoding];
        NSDictionary * frienddict = [NSJSONSerialization JSONObjectWithData:frienddata options:NSJSONReadingMutableContainers error:nil];
        
        NSDictionary *  customerdict = frienddict[@"data"];
        if ([customerdict isKindOfClass:[NSDictionary class]]) {
            self.Current_Version.text = [NSString stringWithFormat:@"版本:%@", customerdict[@"version"]];
            self.Current_companyUrl.text = customerdict[@"website"];
            self.Current_Mailbox.text = [NSString stringWithFormat:@"客服邮箱 :%@",customerdict[@"kf_email"]];
            self.Current_WechatNumber.text = [NSString stringWithFormat:@"微信服务号:%@",customerdict[@"weixin_code"]];
            self.Current_qqService.text = [NSString stringWithFormat:@"客服QQ : %@",customerdict[@"kf_qq"]];
            self.Current_companyphone.text = [NSString stringWithFormat:@"公司电话:%@",customerdict[@"company_phone"]];
            self.Current_message.text = [NSString stringWithFormat:@"%@",customerdict[@"ps"]];
            
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
    
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
